from io import StringIO

# Write to StringIO:
f = StringIO()
f.write('hello')
f.write(' ')
f.write('world!')
print(f.getvalue())

# read from StringIO:
f = StringIO('水面西风生, \n菱歌慢慢声。\n客亭临小市, \n灯火夜妆明。')
while True:
	s = f.readline()
	if s == '':
		break
	print(s.strip())